import http from '../util/https.js';

const API = {
  get: (url) => {
    return http({
      url: url,
      method: 'get'
    });
  },
  getForm: (url,params) => {
    return http({
      url: url,
      method: 'get',
      params:params
    });
  },
  del: (url, id) => {
    return http({
      url: `${url}/${id}`,
      method: 'delete'
    });
  },
  post: (url, data) => {
    return http({
      url: url,
      method: 'post',
      data: data
    });
  },
  postForm: (url, params) => {
    return http({
      url: url,
      method: 'post',
      params: params
    });
  },
  postJson: (url, data) => {
    return http({
      url: url,
      method: 'post',
      data: data
    });
  },
  putForm: (url, params) => {
    return http({
      url: url,
      method: 'put',
      params: params
    });
  },
  putJson: (url, data) => {
    return http({
      url: url,
      method: 'put',
      data: data
    });
  }
};

export default API;
